From: Keir Fraser Date: Mon, 27 Oct 2008 13:20:52 +0000 (+0000) Subject: x86/powernow: fix machine shutdown X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~14054^2~30 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks://%22Dat/%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22Dat?a=commitdiff_plain;h=47fbce220aa977961e19396b1c40bef7508cb84e;p=xen.git x86/powernow: fix machine shutdown cpufreq_del_cpu() calls cpufreq_driver->exit() without checking whether an exit() handler is present, and by adding an exit() handler to powernow we can at once close the potential memory leak. Signed-off-by: Jan Beulich --- diff --git a/xen/arch/x86/acpi/cpufreq/powernow.c b/xen/arch/x86/acpi/cpufreq/powernow.c index 9d9897be61..b43de6a5cf 100644 --- a/xen/arch/x86/acpi/cpufreq/powernow.c +++ b/xen/arch/x86/acpi/cpufreq/powernow.c @@ -229,9 +229,23 @@ err_unreg: return result; } +static int powernow_cpufreq_cpu_exit(struct cpufreq_policy *policy) +{ + struct powernow_cpufreq_data *data = drv_data[policy->cpu]; + + if (data) { + drv_data[policy->cpu] = NULL; + xfree(data->freq_table); + xfree(data); + } + + return 0; +} + static struct cpufreq_driver powernow_cpufreq_driver = { .target = powernow_cpufreq_target, .init = powernow_cpufreq_cpu_init, + .exit = powernow_cpufreq_cpu_exit }; int powernow_cpufreq_init(void)